package week_09;

import week_07.Queue;
import week_07.Stack;
import week_08.BinaryTree;

import java.util.Arrays;

public class findAncestor {
    public static void main(String[] args) {
        BinaryTree<String, String> tree = new BinaryTree<>();
        tree.put("E","5");
        tree.put("B","2");
        tree.put("G","7");
        tree.put("A","1");
        tree.put("D","4");
        tree.put("F","6");
        tree.put("H","8");
        tree.put("C","3");
        Stack<String> stack = tree.findAncestor("A");
        Queue<Integer> queue = tree.TreeWidth();
        int N = stack.size();
        String[] a = new String[N];
        for (int i = 0; i < stack.size(); i++) {
            a[i] = stack.pop();
        }
        a[N-1] = "root";
        System.out.println(Arrays.toString(a));
        System.out.println("——————————————————————————————————");
        System.out.println(queue.pop());
        System.out.println("——————————————————————————————————");
        System.out.println(tree.TreeHeight("D"));

    }
}
